<template>
  <div class="header-box-in">
    <div class="not-line" v-if="!keyData.length || (!componentsData && !keyData.length) || (componentsData && !keyData.length)|| (!componentsData && keyData.length)">
      Please set the data source
    </div>
    <component :is="componentsData" :keyData="keyData" inPage="preview" v-else></component>
  </div>
</template>

<script>
export default {
  name: "header-data",
  props: ['componentsData', 'dataoption'],
  watch: {
    dataoption() {
      this.keyData = JSON.parse(JSON.stringify(this.dataoption.body))
    }
  },
  data(){
    return{
      keyData: []
    }
  }
}
</script>

<style scoped>
.header-box-in {
  height: 100%;
}

.not-line {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #222;
  font-size: 14px;
}
</style>
